/**
Database Type: MySQL
当前生成的表 ${table.name}
@author: ${author}
@since: ${date}
@version ${version}
*/
<#assign menuId = mysqlStartMenuId>
<#assign metaId = mysqlStartMetaMenuId>
-- 默认绑定角色为admin管理员 id = 1
<#assign defaultBindRole = 1>
-- =================================================================BEGIN----菜单OR角色相关sql========================================================================
<#--菜单-->
<#--如果父id为0需要创建一个目录-->
<#if customPageConfig.pid == 0>
    -- 菜单
    INSERT INTO `sys_menu` (`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`, `action_type`, `side_menu_id`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `system_id`, `ext_url`, `tag_dot`, `tag_content`, `tag_type`, `redirect`, `component`, `props`, `alias`, `case_sensitive`, `path_to_regexp_options`, `path`) VALUES (${menuId}, 0, '${moduleNameZh}', NULL, NULL, 0, NULL, 10, 0, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, 'LAYOUT', NULL, NULL, NULL, NULL, '/${package.ModuleName}');
    INSERT INTO `sys_menu_meta` (`menu_meta_id`, `menu_id`, `title`, `component_name`, `ignore_auth`, `roles`, `ignore_keep_alive`, `affix`, `frame_src`, `transition_name`, `hide_breadcrumb`, `carry_param`, `hide_childrenIn_menu`, `current_active_menu`, `hide_tab`, `hide_menu`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `icon`) VALUES (${metaId}, ${menuId}, '${moduleNameZh}', NULL, 1, NULL, 1, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, 'ion:settings-outline');
    <#assign pid = menuId>
    <#assign metaId = metaId + 1>
    <#assign menuId = menuId + 1>
    INSERT INTO `sys_menu` (`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`, `action_type`, `side_menu_id`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `system_id`, `ext_url`, `tag_dot`, `tag_content`, `tag_type`, `redirect`, `component`, `props`, `alias`, `case_sensitive`, `path_to_regexp_options`, `path`) VALUES (${menuId}, ${pid}, '${customTableInfo.businessName!table.comment!}', NULL, '${package.ModuleName}:${tsModelName}', 1, NULL, 1, 0, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, '/${package.ModuleName}/${tsModelName}/index', NULL, NULL, NULL, NULL, '${tsModelName}');
    INSERT INTO `sys_menu_meta` (`menu_meta_id`, `menu_id`, `title`, `component_name`, `ignore_auth`, `roles`, `ignore_keep_alive`, `affix`, `frame_src`, `transition_name`, `hide_breadcrumb`, `carry_param`, `hide_childrenIn_menu`, `current_active_menu`, `hide_tab`, `hide_menu`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `icon`) VALUES (${metaId}, ${menuId}, '${customTableInfo.businessName!table.comment!}', '${entity}', 1, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, 'ant-design:idcard-outlined');

<#--绑定默认角色-->
    -- 角色綁定
    INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES ( ${defaultBindRole}, ${pid});
    INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES ( ${defaultBindRole}, ${menuId});
<#else>
    -- 菜单
    INSERT INTO `sys_menu` (`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`, `action_type`, `side_menu_id`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `system_id`, `ext_url`, `tag_dot`, `tag_content`, `tag_type`, `redirect`, `component`, `props`, `alias`, `case_sensitive`, `path_to_regexp_options`, `path`) VALUES (${menuId}, ${customPageConfig.pid}, '${customTableInfo.businessName!table.comment!}', NULL, '${package.ModuleName}:${tsModelName}', 1, NULL, 1, 0, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, '/${package.ModuleName}/${tsModelName}/index', NULL, NULL, NULL, NULL, '${tsModelName}');
    INSERT INTO `sys_menu_meta` (`menu_meta_id`, `menu_id`, `title`, `component_name`, `ignore_auth`, `roles`, `ignore_keep_alive`, `affix`, `frame_src`, `transition_name`, `hide_breadcrumb`, `carry_param`, `hide_childrenIn_menu`, `current_active_menu`, `hide_tab`, `hide_menu`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `icon`) VALUES (${metaId}, ${menuId}, '${customTableInfo.businessName!table.comment!}', '${entity}', 1, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, 'ant-design:idcard-outlined');

<#--绑定默认角色-->
    -- 角色綁定
    INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES ( ${defaultBindRole}, ${menuId});
</#if>
-- =================================================================END----菜单OR角色相关sql========================================================================

<#--按钮-->
<#--按钮的pid-->
-- =================================================================BEGIN----按钮相关sql========================================================================
<#assign btnPid = menuId>
<#assign metaId = metaId + 1>
<#assign menuId = menuId + 1>
<#if customPageConfig.showDelBtn>
    -- 删除按钮
    INSERT INTO `sys_menu` (`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`, `action_type`, `side_menu_id`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `system_id`, `ext_url`, `tag_dot`, `tag_content`, `tag_type`, `redirect`, `component`, `props`, `alias`, `case_sensitive`, `path_to_regexp_options`, `path`) VALUES (${menuId}, ${btnPid}, '${customTableInfo.businessName!table.comment!}-删除按钮', NULL, '${package.ModuleName}:${tsModelName}:delBtn', 2, NULL, 0, 0, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '');
    INSERT INTO `sys_menu_meta` (`menu_meta_id`, `menu_id`, `title`, `component_name`, `ignore_auth`, `roles`, `ignore_keep_alive`, `affix`, `frame_src`, `transition_name`, `hide_breadcrumb`, `carry_param`, `hide_childrenIn_menu`, `current_active_menu`, `hide_tab`, `hide_menu`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `icon`) VALUES (${metaId}, ${menuId}, '${customTableInfo.businessName!table.comment!}', NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, '');
</#if>
<#assign metaId = metaId + 1>
<#assign menuId = menuId + 1>
<#if customPageConfig.showAddBtn>
    -- 新增按钮
    INSERT INTO `sys_menu` (`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`, `action_type`, `side_menu_id`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `system_id`, `ext_url`, `tag_dot`, `tag_content`, `tag_type`, `redirect`, `component`, `props`, `alias`, `case_sensitive`, `path_to_regexp_options`, `path`) VALUES (${menuId}, ${btnPid}, '${customTableInfo.businessName!table.comment!}-新增按钮', NULL, '${package.ModuleName}:${tsModelName}:addBtn', 2, NULL, 0, 0, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '');
    INSERT INTO `sys_menu_meta` (`menu_meta_id`, `menu_id`, `title`, `component_name`, `ignore_auth`, `roles`, `ignore_keep_alive`, `affix`, `frame_src`, `transition_name`, `hide_breadcrumb`, `carry_param`, `hide_childrenIn_menu`, `current_active_menu`, `hide_tab`, `hide_menu`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `icon`) VALUES (${metaId}, ${menuId}, '${customTableInfo.businessName!table.comment!}', NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, '');
</#if>
<#assign metaId = metaId + 1>
<#assign menuId = menuId + 1>
<#if customPageConfig.showUpdateBtn>
    -- 编辑按钮
    INSERT INTO `sys_menu` (`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`, `action_type`, `side_menu_id`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `system_id`, `ext_url`, `tag_dot`, `tag_content`, `tag_type`, `redirect`, `component`, `props`, `alias`, `case_sensitive`, `path_to_regexp_options`, `path`) VALUES (${menuId}, ${btnPid}, '${customTableInfo.businessName!table.comment!}-编辑按钮', NULL, '${package.ModuleName}:${tsModelName}:editBtn', 2, NULL, 0, 0, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '');
    INSERT INTO `sys_menu_meta` (`menu_meta_id`, `menu_id`, `title`, `component_name`, `ignore_auth`, `roles`, `ignore_keep_alive`, `affix`, `frame_src`, `transition_name`, `hide_breadcrumb`, `carry_param`, `hide_childrenIn_menu`, `current_active_menu`, `hide_tab`, `hide_menu`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `icon`) VALUES (${metaId}, ${menuId}, '${customTableInfo.businessName!table.comment!}', NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, '');
</#if>
<#assign metaId = metaId + 1>
<#assign menuId = menuId + 1>
<#if customPageConfig.existSearchField>
    -- 搜索按钮
    INSERT INTO `sys_menu` (`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`, `action_type`, `side_menu_id`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `system_id`, `ext_url`, `tag_dot`, `tag_content`, `tag_type`, `redirect`, `component`, `props`, `alias`, `case_sensitive`, `path_to_regexp_options`, `path`) VALUES (${menuId}, ${btnPid}, '${customTableInfo.businessName!table.comment!}-搜索按钮', NULL, '${package.ModuleName}:${tsModelName}:searchBtn', 2, NULL, 0, 0, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '');
    INSERT INTO `sys_menu_meta` (`menu_meta_id`, `menu_id`, `title`, `component_name`, `ignore_auth`, `roles`, `ignore_keep_alive`, `affix`, `frame_src`, `transition_name`, `hide_breadcrumb`, `carry_param`, `hide_childrenIn_menu`, `current_active_menu`, `hide_tab`, `hide_menu`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `icon`) VALUES (${metaId}, ${menuId}, '${customTableInfo.businessName!table.comment!}', NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, '');
</#if>
<#assign metaId = metaId + 1>
<#assign menuId = menuId + 1>
<#if customPageConfig.showExportBtn>
    -- 导出按钮
    INSERT INTO `sys_menu` (`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`, `action_type`, `side_menu_id`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `system_id`, `ext_url`, `tag_dot`, `tag_content`, `tag_type`, `redirect`, `component`, `props`, `alias`, `case_sensitive`, `path_to_regexp_options`, `path`) VALUES (${menuId}, ${btnPid}, '${customTableInfo.businessName!table.comment!}-导出按钮', NULL, '${package.ModuleName}:${tsModelName}:exportBtn', 2, NULL, 0, 0, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '');
    INSERT INTO `sys_menu_meta` (`menu_meta_id`, `menu_id`, `title`, `component_name`, `ignore_auth`, `roles`, `ignore_keep_alive`, `affix`, `frame_src`, `transition_name`, `hide_breadcrumb`, `carry_param`, `hide_childrenIn_menu`, `current_active_menu`, `hide_tab`, `hide_menu`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `icon`) VALUES (${metaId}, ${menuId}, '${customTableInfo.businessName!table.comment!}', NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, '');
</#if>
<#assign metaId = metaId + 1>
<#assign menuId = menuId + 1>
<#if customPageConfig.showImportBtn>
    -- 导入按钮
    INSERT INTO `sys_menu` (`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`, `action_type`, `side_menu_id`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `system_id`, `ext_url`, `tag_dot`, `tag_content`, `tag_type`, `redirect`, `component`, `props`, `alias`, `case_sensitive`, `path_to_regexp_options`, `path`) VALUES (${menuId}, ${btnPid}, '${customTableInfo.businessName!table.comment!}-导入按钮', NULL, '${package.ModuleName}:${tsModelName}:importBtn', 2, NULL, 0, 0, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '');
    INSERT INTO `sys_menu_meta` (`menu_meta_id`, `menu_id`, `title`, `component_name`, `ignore_auth`, `roles`, `ignore_keep_alive`, `affix`, `frame_src`, `transition_name`, `hide_breadcrumb`, `carry_param`, `hide_childrenIn_menu`, `current_active_menu`, `hide_tab`, `hide_menu`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `icon`) VALUES (${metaId}, ${menuId}, '${customTableInfo.businessName!table.comment!}', NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, '');
</#if>
<#assign metaId = metaId + 1>
<#assign menuId = menuId + 1>
<#if customPageConfig.isBatch>
    -- 批量删除按钮
    INSERT INTO `sys_menu` (`menu_id`, `parent_id`, `name`, `url`, `perms`, `type`, `icon`, `order_num`, `action_type`, `side_menu_id`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `system_id`, `ext_url`, `tag_dot`, `tag_content`, `tag_type`, `redirect`, `component`, `props`, `alias`, `case_sensitive`, `path_to_regexp_options`, `path`) VALUES (${menuId}, ${btnPid}, '${customTableInfo.businessName!table.comment!}-批量删除', NULL, '${package.ModuleName}:${tsModelName}:batchDelBtn', 2, NULL, 0, 0, NULL, NULL, NULL, NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '');
    INSERT INTO `sys_menu_meta` (`menu_meta_id`, `menu_id`, `title`, `component_name`, `ignore_auth`, `roles`, `ignore_keep_alive`, `affix`, `frame_src`, `transition_name`, `hide_breadcrumb`, `carry_param`, `hide_childrenIn_menu`, `current_active_menu`, `hide_tab`, `hide_menu`, `menu_ext_value1`, `menu_ext_value2`, `menu_ext_value3`, `icon`) VALUES (${metaId}, ${menuId}, '${customTableInfo.businessName!table.comment!}', NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, '');
</#if>

-- =================================================================END----按钮相关sql========================================================================
